/* var myHeading = document.querySelector('h1');
myHeading.innerHTML = 'Hello world!'; */
var myImage = document.querySelector('img');

myImage.onclick = function(){
	var mySrcImage = myImage.getAttribute('src');
	if(mySrcImage === 'images/mozilla1.png'){
		myImage.setAttribute('src','images/google1.png');
		/* alert('Ouch! Stop click me!'); */
	}
	else{
		myImage.setAttribute('src','images/mozilla1.png');
	}
}

var myButton = document.querySelector('button');
var myHeading = document.querySelector('h1');

function setName(){
	var myName = prompt('请输入你的名字');
	localStorage.setItem('name',myName);
	myHeading.innerHTML = 'Cool, '+ myName;
}

if(!localStorage.getItem('name')) {
  setName();
} else {
  var storedName = localStorage.getItem('name');
  myHeading.innerHTML = 'Cool, ' + storedName;
}

myButton.onclick = function(){
	setName();
}